//
//  CZHomeTitleButton.swift
//  iOSWeibo10
//
//  Created by ge on 16/5/14.
//  Copyright © 2016年 ge. All rights reserved.
//

import UIKit

class CZHomeTitleButton: UIButton {

    override func layoutSubviews() {
        // 一定要记得调用父类
        super.layoutSubviews()
        
        // 1.将文字的frame.origin.x = 0
//        let labelFrame = titleLabel!.frame
//        titleLabel?.frame = CGRect(x: 0, y: labelFrame.origin.y, width: labelFrame.width, height: labelFrame.height)
        //OC两句话，swift一句即可
        titleLabel?.frame.origin.x = 0
        
        // 2.将图片的frame.origin.x设置为文字的宽度
        imageView?.frame.origin.x = titleLabel!.frame.width + 3
    }

}
